Imperative programming languages require users to define a sequence of specific commands that a machine should perform to achieve a desired result. In contrast, declarative programming languages allow users to define the end result that a program should accomplish without describing the specific actions to be taken. A declarative program describes a desired result without explicitly listing steps to be performed by the machine.
When performing a repetitive task, such as configuring a large number of servers in a distributed or cloud-computing environment, it is helpful to automate such tasks. When using imperative scripting languages for automation, all of the actions required to accomplish the task must be included in the program for each different scenario that may be encountered to ensure that the task will be completed. As a result, using scripting languages for automation can be an error-prone process because the user must verify that the desired result was accomplished (e.g., check error codes) each time the task was executed.